<div id="contract-detail-view">
  <div class="page">
    <div class="contract-info-container" ng-if="contract">
      <ng-form form="contractEditForm" class="form-horizontal form-validation">
        <div class="form-group">
          <h3 class="text-center">合同信息编辑</h3>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">合同号</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.uuid}}</div>
          </div>

        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">公寓</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.apartmentName}}</div>
          </div>
          <label class="control-label col-sm-2">楼栋</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.buildingName}}</div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">房间号</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.houseNo}}</div>
          </div>
          <label class="control-label col-sm-2">地址</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.address}}</div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">合同状态</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.statusName}}</div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">租期</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.leaseName}}</div>
          </div>
          <label class="control-label col-sm-2">付款方式</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.payWayName}}</div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">合同开始日期</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.leaseStart|dateTransfer:'YYYY-MM-DD'}}</div>
          </div>
          <label class="control-label col-sm-2">合同结束日期</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.leaseEnd|dateTransfer:'YYYY-MM-DD'}}</div>
          </div>
        </div>

        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">租金</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.rental}}</div>
          </div>
          <label class="control-label col-sm-2">押金</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.deposit}}</div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-sm-2 col-sm-offset-1">合同状态</label>
          <div class="col-sm-3">
            <div class="form-control info-text">{{contract.statusName}}</div>
          </div>
          <!--<label class="control-label col-sm-2">水费余额</label>-->
          <!--<div class="col-sm-3">-->
          <!--<div class="form-control info-text">{{contract.waterBalance}}</div>-->
          <!--</div>-->
        </div>
        <div class="form-group">
          <h4 class="text-center">租客信息</h4>
        </div>
        <div class="form-group">
          <div class="col-sm-6">
            <div class="form-group">
              <label class="control-label col-sm-4 col-sm-offset-2">租客手机号<span class="attr-need">*</span></label>
              <div class="col-sm-6">
                <div class="form-control info-text">{{contract.customerPhone}}</div>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-4 col-sm-offset-2">租客名称<span class="attr-need">*</span></label>
              <div class="col-sm-6">
                <input type="text" class="form-control" required
                       ng-model="contract.customerName">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-4 col-sm-offset-2">身份证<span class="attr-need">*</span></label>
              <div class="col-sm-6">
                <input type="text" class="form-control" required
                       ng-pattern="$root.idCardVd"
                       ng-model="contract.customerCard">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-4 col-sm-offset-2">性别</label>
              <div class="col-sm-6">
                <nobr>
                  <label class="ui-radio" ng-repeat="option in sexList">
                    <input name="status" ng-value="option.value"
                           type="radio" ng-model="contract.sex">
                    <span>{{option.name}}</span>
                  </label>
                </nobr>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-4 col-sm-offset-2">住客人数</label>
              <div class="col-sm-6">
                <div class="input-group">
                  <input type="number" class="form-control" readonly ng-model="contract.cotenants.length" maxlength="4">
                  <span class="input-group-addon" ng-click="openCotenant('edit',contract.cotenants)">编辑</span>
                </div>
              </div>
            </div>
          </div>
          <div class="col-sm-6">
            <div class="form-group" style="margin-bottom: 10px;">
              <label class="control-label col-sm-4 ">身份证正面</label>
              <div class="col-sm-6 id-card-container">
                <img id="ce-idcard-front-img"
                     ng-src="{{contract.idcardFront?contract.idcardFront:'images/id_card_front.jpg'}}"
                     ng-click="uploadImageData('#ce-idcard-front','idcardFront')">
                <input id="ce-idcard-front" style="display: none" type="file">
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-sm-4">身份证反面</label>
              <div class="col-sm-6 id-card-container">
                <img ng-src="{{contract.idcardBack?contract.idcardBack:'images/id_card_back.jpg'}}"
                     ng-click="uploadImageData('#ce-idcard-back','idcardBack')">
                <input id="ce-idcard-back" style="display: none" type="file">
              </div>
            </div>
          </div>

        </div>

        <div class="form-group">
          <div class="col-sm-12 text-center">
            <button class="btn btn-default mr-15" ng-click="resetData()">重置</button>
            <button class="btn btn-primary mr-15" ng-disabled="contract.status>=8 || contractEditForm.$invalid"
                    ng-click="saveData()">保存</button>
            <button class="btn btn-warning mr-15" ng-click="printContract()">合同打印</button>
          </div>
        </div>
      </ng-form>
    </div>
  </div>
</div>